package com.google.code.sharecontent.action;

import java.sql.SQLException;
import java.util.List;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

import com.google.code.sharecontent.model.ContentsArtistsView;
import com.google.code.sharecontent.model.Paging;
import com.google.code.sharecontent.model.User;

@Scope(ScopeType.CONVERSATION)
@Name("mainAction")
public class MainAction extends BaseAction {

	@In("daoAction")
	private DaoAction daoAction;
	
	@In
	User user;

	private Paging paging; 

	List<ContentsArtistsView> listTopArtists;
	
	public List<ContentsArtistsView> getListTopArtists() {
		if (this.listTopArtists == null) {
			try {
				this.listTopArtists = daoAction.getContentsArtistsViewDao().list("KOL desc");
			} catch (SQLException e) {
				log.error(e.getMessage());
			}
		}
		return this.listTopArtists;
	}
	
	@Begin
	public void start() {
		log.info(" start");
	}
	
	@End
	public void end() {
		log.info(" end");
	}
	
	public Paging getPaging() {
		if (this.paging == null) {
			this.paging = new Paging();
		}
		return paging;
	}

	public void setPaging(Paging paging) {
		this.paging = paging;
	}
}
